{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "#DataFrame.to_excel(excel_writer, sheet_name='Sheet1', na_rep='', float_format=None, columns=None, header=True, index=True, index_label=None, startrow=0, startcol=0, engine=None, merge_cells=True, encoding=None, inf_rep='inf', verbose=True, freeze_panes=None)\n",
    "'''\n",
    "该函数主要参数为:excel_writer。\n",
    "excel_writer:写入的目标excel文件，可以是文件路径、ExcelWriter对象;\n",
    "sheet_name:被写入的sheet名称，string类型，默认为'sheet1';\n",
    "na_rep:缺失值表示，string类型;\n",
    "header:是否写表头信息，布尔或list of string类型，默认为True;\n",
    "index:是否写行号，布尔类型，默认为True;\n",
    "encoding:指定写入编码，string类型。\n",
    "'''\n",
    "import pandas as pd\n",
    "writer = pd.ExcelWriter('output.xlsx')\n",
    "df1 = pd.DataFrame(data={'col1':[1,1], 'col2':[2,2]})\n",
    "df1.to_excel(writer,'Sheet1')\n",
    "writer.save()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0    a\n",
      "Name: 1, dtype: object\n"
     ]
    }
   ],
   "source": [
    " #pd.read_excel(io, sheetname=0, header=0, skiprows=None, skip_footer=0, index_col=None, names=None, parse_cols=None, parse_dates=False, date_parser=None, na_values=None, thousands=None, convert_float=True, has_index_names=None, converters=None, dtype=None, true_values=None, false_values=None, engine=None, squeeze=False, **kwds)\n",
    " '''\n",
    " 该函数主要的参数为io、sheetname、header、names、encoding。\n",
    " io:excel文件，可以是文件路径、文件网址、file-like对象、xlrd workbook;\n",
    " sheetname:返回指定的sheet，参数可以是字符串（sheet名）、整型（sheet索引）、list（元素为字符串和整型，返回字典{'key':'sheet'}）、none（返回字典，全部sheet）;\n",
    " header:指定数据表的表头，参数可以是int、list of ints，即为索引行数为表头;\n",
    " names:返回指定name的列，参数为array-like对象。\n",
    " encoding:关键字参数，指定以何种编码读取。\n",
    " 该函数返回pandas中的DataFrame或dict of DataFrame对象，利用DataFrame的相关操作即可读取相应的数据。\n",
    " '''\n",
    " #代码示例:\n",
    " import pandas as pd\n",
    " excel_path = 'C:/Users/Chan Kiang/Desktop/example.xlsx'\n",
    " d = pd.read_excel(excel_path, sheet_name=None)\n",
    " print(d['Sheet1'][1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
